<?php
	include_once 'autoload.php';
	

	session_start();

	$ctl = new EditAlbumCtl();
	$ctl->checkLogged();
	$ctl->checkNotReadonly();
	$ctl->proceed();
	
	$header = new Header();
	$header->render('Update Album');

	$form = $ctl->getEditAlbumForm();
	

	$adding = $form->isAdding();
	$addingVal = $adding ? 'yes' : '';
	
	$title = $adding ? 'Add' : 'Edit';
	$name = $form->getName();
	$id = $form->getId();
	
?>
<form method="post">
<input type="hidden" name="pagename" value="editalbum" id="pgid">
<input type="hidden" name="metname" value="" id="metid">
<input type="hidden" name="adding" value="<?php echo $addingVal; ?>" >
<input type="hidden" name="id" value="<?php echo $id; ?>" >

<h2><?php echo $title; ?> Album</h2>
<table cellpadding="8" cellspacing="0" class="list">
  <tr>
    <td>Album name: </td>
    <td><input type="text" name="name" value="<?php echo $name; ?>"></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
	    <input type="button" value="Submit" onclick="triggerform('submit')" class="enter">
	    <input type="button" value="Cancel" onclick="triggerform('cancel')" class="escape">
    </td>
    </tr>
</table>
</form>
<?php
	$footer = new Footer();
	$footer->render();
?>
